using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy2 : Entity
{
    public E2_MoveState moveState { get; private set; }
    public E2_IdleState idleState { get; private set; }
    public E2_PlayerDetectedState playerDetectedState { get; private set; }

    public E2_MeleeAttackState meleeAttackState { get; private set; }

    public E2_LookForPlayerState lookForPlayerState { get; private set; }

    public E2_StunState stunState { get; private set; }

    public E2_DeadState deadState { get; private set; }

    public E2_DodgeState dodgeState { get; private set; }

    public E2_RangeAttackState rangeAttackState { get; private set; }

    [SerializeField]
    private D_MoveState moveStateData;

    [SerializeField]
    private D_IdleState idleStateData;

    [SerializeField]
    private D_PlayerDetected playerDetectedData;

    [SerializeField]
    private D_MeleeAttack meleeAttackData;

    [SerializeField]
    private Transform meleeAttackPosition;

    [SerializeField]
    private D_LookForPlayer lookForPlayerData;

    [SerializeField]
    private D_StunState stunStateData;

    [SerializeField]
    private D_DeadState deadStateData;

    [SerializeField]
    public D_DodgeState dodgeStateData;

    [SerializeField]
    public D_RangeAttackState rangeAttackStateData;

    [SerializeField]
    private Transform rangeAttackPosition;

    public override void Awake()
    {
        base.Awake();
        moveState = new E2_MoveState(this, stateMachine, "move", moveStateData, this);
        idleState = new E2_IdleState(this, stateMachine, "idle", idleStateData, this);
        playerDetectedState = new E2_PlayerDetectedState(this, stateMachine, "playerDetected", playerDetectedData, this);
        meleeAttackState = new E2_MeleeAttackState(this,stateMachine,"meleeAttack", meleeAttackPosition,meleeAttackData, this);
        lookForPlayerState = new E2_LookForPlayerState(this,stateMachine,"lookForPlayer",lookForPlayerData,this);
        stunState = new E2_StunState(this,stateMachine,"stun",stunStateData,this);
        deadState = new E2_DeadState(this, stateMachine, "dead", deadStateData, this);
        dodgeState = new E2_DodgeState(this, stateMachine, "dodge", dodgeStateData, this);
        rangeAttackState = new E2_RangeAttackState(this,stateMachine,"rangeAttack", rangeAttackPosition, rangeAttackStateData,this);

        
    }

    private void Start()
    {
        stateMachine.Initialize(moveState);
    }

   
    public override void OnDrawGizmos()
    {
        base.OnDrawGizmos();
        Gizmos.DrawWireSphere(meleeAttackPosition.position,meleeAttackData.attackRadius);
    }
}
